home *** CD-ROM | disk | FTP | other *** search
-
- // Copyright (C) 2002 by Luigi Pino. All Rights Reserved.
-
- /***************************************************************************/
-
- #include "../library/neurosis.h"
- #include "draw.h"
- #include "file_io.h"
- #include "hiscore.h"
- #include "initialize.h"
- #include "main.h"
- #include "menu_misc.h"
- #include "paddle.h"
- #include "sphere.h"
- #include "update.h"
-
- /***************************************************************************/
-
- extern Camera_Class camera;
- extern Light_Values_Struct light_values;
- extern Mouse_Class mouse;
- extern Object4_Class wall_net;
- extern Object4_Class wall_side;
- extern Paddle_Struct paddle_object[];
- extern Timing_Class timing;
- extern Values_Struct values;
-
- extern float3 wall_pts[];
-
- /***************************************************************************/
-
- void Update_Current_Light_Point()
-
- {
- float check_lowest_score = 2000;
- int check_rotate_value = 0;
- int x1;
-
- // Get lowest score
- for (x1=Up;x1<=Right;x1=x1+1)
- {
- if (paddle_object[x1].game_over == false)
- {
- if (paddle_object[x1].score < check_lowest_score)
- check_lowest_score = paddle_object[x1].score;
- }
- }
-
- // Compare to find lowest score player
- for (x1=Up;x1<=Right;x1=x1+1)
- {
- if (paddle_object[x1].game_over == false)
- {
- if (paddle_object[x1].score == check_lowest_score)
- {
- if (x1 == Right)
- check_rotate_value = check_rotate_value + 1;
- else if (x1 == Up)
- check_rotate_value = check_rotate_value + 2;
- else if (x1 == Left)
- check_rotate_value = check_rotate_value + 4;
- else if (x1 == Down)
- check_rotate_value = check_rotate_value + 8;
- }
- }
- }
-
- light_values.distance_destination = 90.0f;
-
- if (check_rotate_value == 0)
- light_values.distance_destination = 0.0f;
- else if (check_rotate_value == 1)
- light_values.rotate_destination = 0.0f;
- else if (check_rotate_value == 2)
- light_values.rotate_destination = 90.0f;
- else if (check_rotate_value == 3)
- light_values.rotate_destination = 45.0f;
- else if (check_rotate_value == 4)
- light_values.rotate_destination = 180.0f;
- else if (check_rotate_value == 5)
- light_values.distance_destination = 0.0f;
- else if (check_rotate_value == 6)
- light_values.rotate_destination = 135.0f;
- else if (check_rotate_value == 7)
- {
- light_values.rotate_destination = 90.0f;
- light_values.distance_destination = 50.0f;
- }
- else if (check_rotate_value == 8)
- light_values.rotate_destination = 270.0f;
- else if (check_rotate_value == 9)
- light_values.rotate_destination = 315.0f;
- else if (check_rotate_value == 10)
- light_values.distance_destination = 0.0f;
- else if (check_rotate_value == 11)
- {
- light_values.rotate_destination = 0.0f;
- light_values.distance_destination = 50.0f;
- }
- else if (check_rotate_value == 12)
- light_values.rotate_destination = 225.0f;
- else if (check_rotate_value == 13)
- {
- light_values.rotate_destination = 270.0f;
- light_values.distance_destination = 50.0f;
- }
- else if (check_rotate_value == 14)
- {
- light_values.rotate_destination = 180.0f;
- light_values.distance_destination = 50.0f;
- }
- else if (check_rotate_value == 15)
- light_values.distance_destination = 0.0f;
-
- // Update current position
- if (light_values.distance_current < light_values.distance_destination)
- {
- light_values.distance_current = light_values.distance_current + (10.0f * timing.Get_Scale());
-
- if (light_values.distance_current > light_values.distance_destination)
- light_values.distance_current = light_values.distance_destination;
- }
- else if (light_values.distance_current > light_values.distance_destination)
- {
- light_values.distance_current = light_values.distance_current - (10.0f * timing.Get_Scale());
-
- if (light_values.distance_current < light_values.distance_destination)
- light_values.distance_current = light_values.distance_destination;
- }
-
- if (light_values.rotate_current < light_values.rotate_destination)
- {
- if ((light_values.rotate_destination - light_values.rotate_current) > 180)
- light_values.rotate_current = light_values.rotate_current - (10.0f * timing.Get_Scale());
- else
- {
- light_values.rotate_current = light_values.rotate_current + (10.0f * timing.Get_Scale());
-
- if (light_values.rotate_current > light_values.rotate_destination)
- light_values.rotate_current = light_values.rotate_destination;
- }
- }
- else if (light_values.rotate_current > light_values.rotate_destination)
- {
- if ((light_values.rotate_current - light_values.rotate_destination) > 180)
- light_values.rotate_current = light_values.rotate_current + (10.0f * timing.Get_Scale());
- else
- {
- light_values.rotate_current = light_values.rotate_current - (10.0f * timing.Get_Scale());
-
- if (light_values.rotate_current < light_values.rotate_destination)
- light_values.rotate_current = light_values.rotate_destination;
- }
- }
-
- Fix_Angle(&light_values.rotate_current);
- }
-
- /***************************************************************************/
-
- void Update_Mouse()
-
- {
- mouse.Get_Info(true);
-
- // Movement left/right
- if (mouse.change.x != 0.0f)
- camera.axis_destination.z = camera.axis_current.z = camera.axis_current.z + (mouse.change.x * 8.0f * timing.Get_Scale());
-
- // Movement up/down
- if (mouse.change.y != 0.0f)
- camera.axis_destination.x = camera.axis_current.x = camera.axis_current.x + (mouse.change.y * 8.0f * timing.Get_Scale());
-
- // Bound up/down mouse movement
- if (camera.axis_current.x < 285.0f)
- camera.axis_current.x = 285.0f;
- else if (camera.axis_current.x > 359.0f)
- camera.axis_current.x = 359.0f;
-
- // Zoom in
- if ((mouse.button[0].x > 0.0f) && (camera.zoom_current < -60.0f))
- {
- camera.zoom_destination = camera.zoom_current = camera.zoom_current + (150.0f * timing.Get_Scale());
-
- if (camera.zoom_current > -60.0f)
- camera.zoom_destination = camera.zoom_current = -60.0f;
- }
-
- // Zoom out
- if ((mouse.button[1].x > 0.0f) && (camera.zoom_current > -900.0f))
- {
- camera.zoom_destination = camera.zoom_current = camera.zoom_current - (150.0f * timing.Get_Scale());
-
- if (camera.zoom_current < -800.0f)
- camera.zoom_destination = camera.zoom_current = -800.0f;
- }
- }
-
- /***************************************************************************/
-
- void Update_Nets()
-
- {
- // Top net
- if ((paddle_object[Up].game_over == true) && (wall_pts[35].x < -20.0f))
- {
- if (wall_pts[35].y > 185.0f)
- {
- wall_pts[35].y = wall_pts[36].y = wall_pts[35].y - (5.0f * timing.Get_Scale());
-
- if (wall_pts[35].y < 185.0f)
- wall_pts[35].y = wall_pts[36].y = 185.0f;
- }
-
- wall_pts[35].x = wall_pts[35].x + (5.0f * timing.Get_Scale());
- wall_pts[36].x = -(wall_pts[35].x);
-
- if (wall_pts[35].x > -20.0f)
- {
- wall_pts[35].x = -20.0f;
- wall_pts[36].x = 20.0f;
- }
-
- // Wall
- wall_side.Set_Position(31, wall_pts[34].x, wall_pts[34].y, values.wall_height, wall_pts[35].x, wall_pts[35].y,
- values.wall_height, wall_pts[35].x, wall_pts[35].y, 0.0f, wall_pts[34].x, wall_pts[34].y, 0.0f);
-
- wall_net.Set_Position(2, wall_pts[35].x, wall_pts[35].y, values.wall_height, wall_pts[36].x, wall_pts[36].y,
- values.wall_height, wall_pts[36].x, wall_pts[36].y, 0.0f, wall_pts[35].x, wall_pts[35].y, 0.0f);
-
- wall_side.Set_Position(32, wall_pts[36].x, wall_pts[36].y, values.wall_height, wall_pts[37].x, wall_pts[37].y,
- values.wall_height, wall_pts[37].x, wall_pts[37].y, 0.0f, wall_pts[36].x, wall_pts[36].y, 0.0f);
- }
-
- // Bottom net
- if ((paddle_object[Down].game_over == true) && (wall_pts[12].x < -20.0f))
- {
- if (wall_pts[11].y < -185.0f)
- {
- wall_pts[11].y = wall_pts[12].y = wall_pts[11].y + (5.0f * timing.Get_Scale());
-
- if (wall_pts[11].y > -185.0f)
- wall_pts[11].y = wall_pts[12].y = -185.0f;
- }
-
- wall_pts[12].x = wall_pts[12].x + (5.0f * timing.Get_Scale());
- wall_pts[11].x = -(wall_pts[12].x);
-
- if (wall_pts[12].x > -20.0f)
- {
- wall_pts[12].x = -20.0f;
- wall_pts[11].x = 20.0f;
- }
-
- // Wall
- wall_side.Set_Position(9, wall_pts[10].x, wall_pts[10].y, values.wall_height, wall_pts[11].x, wall_pts[11].y,
- values.wall_height, wall_pts[11].x, wall_pts[11].y, 0.0f, wall_pts[10].x, wall_pts[10].y, 0.0f);
-
- wall_net.Set_Position(0, wall_pts[11].x, wall_pts[11].y, values.wall_height, wall_pts[12].x, wall_pts[12].y,
- values.wall_height, wall_pts[12].x, wall_pts[12].y, 0.0f, wall_pts[11].x, wall_pts[11].y, 0.0f);
-
- wall_side.Set_Position(10, wall_pts[12].x, wall_pts[12].y, values.wall_height, wall_pts[13].x, wall_pts[13].y,
- values.wall_height, wall_pts[13].x, wall_pts[13].y, 0.0f, wall_pts[12].x, wall_pts[12].y, 0.0f);
- }
-
- // Right net
- if ((paddle_object[Right].game_over == true) && (wall_pts[48].y < -20.0f))
- {
- if (wall_pts[47].x > 185.0f)
- {
- wall_pts[47].x = wall_pts[48].x = wall_pts[47].x - (5.0f * timing.Get_Scale());
-
- if (wall_pts[47].x < 185.0f)
- wall_pts[47].x = wall_pts[48].x = 185.0f;
- }
-
- wall_pts[48].y = wall_pts[48].y + (5.0f * timing.Get_Scale());
- wall_pts[47].y = -(wall_pts[48].y);
-
- if (wall_pts[48].y > -20.0f)
- {
- wall_pts[48].y = -20.0f;
- wall_pts[47].y = 20.0f;
- }
-
- // Wall
- wall_side.Set_Position(42, wall_pts[46].x, wall_pts[46].y, values.wall_height, wall_pts[47].x, wall_pts[47].y,
- values.wall_height, wall_pts[47].x, wall_pts[47].y, 0.0f, wall_pts[46].x, wall_pts[46].y, 0.0f);
-
- wall_net.Set_Position(3, wall_pts[47].x, wall_pts[47].y, values.wall_height, wall_pts[48].x, wall_pts[48].y,
- values.wall_height, wall_pts[48].x, wall_pts[48].y, 0.0f, wall_pts[47].x, wall_pts[47].y, 0.0f);
-
- wall_side.Set_Position(43, wall_pts[48].x, wall_pts[48].y, values.wall_height, wall_pts[49].x, wall_pts[49].y,
- values.wall_height, wall_pts[49].x, wall_pts[49].y, 0.0f, wall_pts[48].x, wall_pts[48].y, 0.0f);
- }
-
- // Left net
- if ((paddle_object[Left].game_over == true) && (wall_pts[23].y < -20.0f))
- {
- if (wall_pts[23].x < -185.0f)
- {
- wall_pts[23].x = wall_pts[24].x = wall_pts[23].x + (5.0f * timing.Get_Scale());
-
- if (wall_pts[23].x > -185.0f)
- wall_pts[23].x = wall_pts[24].x = -185.0f;
- }
-
- wall_pts[23].y = wall_pts[23].y + (5.0f * timing.Get_Scale());
- wall_pts[24].y = -(wall_pts[23].y);
-
- if (wall_pts[23].y > -20.0f)
- {
- wall_pts[23].y = -20.0f;
- wall_pts[24].y = 20.0f;
- }
-
- // Wall
- wall_side.Set_Position(20, wall_pts[22].x, wall_pts[22].y, values.wall_height, wall_pts[23].x, wall_pts[23].y,
- values.wall_height, wall_pts[23].x, wall_pts[23].y, 0.0f, wall_pts[22].x, wall_pts[22].y, 0.0f);
-
- wall_net.Set_Position(1, wall_pts[23].x, wall_pts[23].y, values.wall_height, wall_pts[24].x, wall_pts[24].y,
- values.wall_height, wall_pts[24].x, wall_pts[24].y, 0.0f, wall_pts[23].x, wall_pts[23].y, 0.0f);
-
- wall_side.Set_Position(21, wall_pts[24].x, wall_pts[24].y, values.wall_height, wall_pts[25].x, wall_pts[25].y,
- values.wall_height, wall_pts[25].x, wall_pts[25].y, 0.0f, wall_pts[24].x, wall_pts[24].y, 0.0f);
- }
-
- Initialize_Ground_Cover();
- }
-
- /***************************************************************************/